package com.ds.infrastructure.hyperspace.container.endpoint.destination.resolver.raw;

import com.google.common.collect.Sets;
import com.ds.infrastructure.hyperspace.common.config.TargetNodeConfig;
import com.ds.infrastructure.hyperspace.container.endpoint.destination.resolver.BaseResolverProvider;
import com.ds.infrastructure.hyperspace.container.internal.NettyContainer;

import java.net.InetSocketAddress;
import java.util.Set;

/**
 * @Author: yaozh
 * @Description:
 */
public class RawResolverProvider extends BaseResolverProvider {
    public RawResolverProvider(NettyContainer nettyContainer, TargetNodeConfig targetNodeConfig, String namespace) {
        super(nettyContainer, targetNodeConfig, namespace);
        init(targetNodeConfig);
    }

    private void init(TargetNodeConfig targetNode) {
        Set<InetSocketAddress> newNodeSet = Sets.newHashSet(
                new InetSocketAddress(targetNode.getHost(), targetNode.getPort()));
        reloadNode(newNodeSet);
    }

    @Override
    public void cancel() {
    }
}
